package com.project.service;

import com.project.bean.UserBean;
import com.project.dao.IUserDao;
import com.project.dao.impl.IUserDaoImpl;
import com.project.server.Request;
import com.project.server.Response;

public class LoginService implements Servlet{
    private IUserDao dao = new IUserDaoImpl();

    /**
     * 业务方法，处理登陆
     * @param request 请求对象
     * @param response 响应对象
     */
    public void service(Request request , Response response){
//        得到表单数据
        String userName = request.getParamMap("userName");
        String pwd = request.getParamMap("pwd");
//        得到登陆数据
        UserBean user = dao.login(userName,pwd);
        if (user!=null){
            response.sendMessage("登陆成功！");
        } else {
            response.sendMessage("登陆失败");
        }

    }
}
